
//开始
cc.Class({
    extends: cc.Component,

    properties: {

        gameName:{
            default:null,
            type:cc.Node,
        },
        bg:{
            default:null,
            type:cc.Node,
        },
        startBtn:{
            default:null,
            type:cc.Button
        },
        btnEffect:cc.AudioClip,
    },

    onLoad(){
        // this.bg.width = cc.winSize.width;
        // this.bg.height = cc.winSize.height;
        // this.bg.setPosition(this.bg.width/2,this.bg.height/2);

        // var action = cc.repeatForever(cc.sequence(cc.scaleTo(1,1.5),cc.scaleTo(1,1)));
        // this.gameName.runAction(action);
        // this.gameName.setPosition(this.bg.getPositionX(),this.bg.getPositionY());

        // this.startBtn.node.setPosition(this.gameName.getPositionX(),this.gameName.getPositionY()-210);
    },

    onEnable(){
        var action = cc.repeatForever(cc.sequence(cc.scaleTo(1,1.5),cc.scaleTo(1,1)));
        this.gameName.runAction(action);

        this.startBtn.node.on(cc.Node.EventType.TOUCH_END,function(event){
            this.startGame();
        },this);
    },

    onDisable(){
        this.gameName.stopAllActions();

        this.startBtn.node.off(cc.Node.EventType.TOUCH_END,function(event){
            this.startGame();
        },this);
    },

    startGame(){
        cc.audioEngine.playEffect(this.btnEffect);
        this.panelManager.setStartpanel(false);
        this.panelManager.setGamepanel(true);
    },
});
